package com.tron.dobest.java.tronio;

import java.io.*;

public class TronCopy {
    public static void main(String[] args) throws Exception {
        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("src/main/java/com/tron/dobest/java/tronio/hello.txt"));
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("src/main/java/com/tron/dobest/java/tronio/hellocopy.txt"));
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int bytesRead = 0;
        while ((bytesRead = bufferedInputStream.read(buf)) != -1) {
            byteArrayOutputStream.write(buf,0,bytesRead);
        }
        byteArrayOutputStream.writeTo(bufferedOutputStream);
        bufferedInputStream.close();
        bufferedOutputStream.close();
        byteArrayOutputStream.close();
    }
}
